package com.hysoft.controller;


import com.hysoft.service.ConnectionTester;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
@RequestMapping("/ConnectionTesterController")
public class ConnectionTesterController {

    @Autowired
    private ConnectionTester connectionTester;

    /**
     *
     * @param host 主机地址
     * @param port 端口
     * @param SID 服务名称
     * @param username 登录口令
     * @param password 口令密码
     * @return
     */

    @RequestMapping("/oracleTester")
    @ResponseBody
    public String connectionOracleTester(String host,String port,String SID,String username,String password){
        String oracleTestResult = connectionTester.testOracleConnection(host, port, SID, username, password);
        return oracleTestResult;
    }

    /**
     *
     * @param path
     * @return
     */

    @RequestMapping("/accessTester")
    @ResponseBody
    public String connectionAccessTester(String path){
        String accessTestResult = connectionTester.testAccessConnection(path);
        return accessTestResult;
    }

}
